﻿#ifndef STACKWINDOW_H
#define STACKWINDOW_H
#include<QDockWidget>
#include<QVBoxLayout>
#include<QHBoxLayout>
#include<QPushButton>
#include<QEvent>
class StackWindow:public QDockWidget
{
    Q_OBJECT
private:
    int _padding_enable_top,_padding_enable_down,_padding_enable_left,_padding_enable_right;
    int _padding_top,_padding_down,_padding_left,_padding_right;
    void _setPadding(int &padding_enable,int &padding_i,const int &padding_to_size);
public:
    Qt::AlignmentFlag _v_alignmentFlag,_h_alignmentFlag;
    StackWindow(QWidget *parent,const Qt::AlignmentFlag &v_alignment,const Qt::AlignmentFlag &h_alignment,const QPoint &pos);
    virtual ~StackWindow();
    QWidget *widget;
    int _dis_x,_dis_y;
    enum MyEdge {
        TopEdge,
        BottomEdge,
        LeftEdge,
        RightEdge
    };
    void updateDisplay();
    void setPadding(MyEdge edge,int padding_px);
public slots:
      //处理 DockWidget 上的鼠标事件的槽函
signals:
    //void mouseReceiveEvent(QEvent * event);
protected:
    virtual bool event(QEvent *event) override {
            // 在这里处理鼠标事件
            if (event->type() == QEvent::MouseButtonPress ||
                event->type() == QEvent::MouseButtonRelease ||
                event->type() == QEvent::MouseButtonDblClick ||
                event->type() == QEvent::MouseMove) {
                // 在这里可以添加处理按钮的鼠标事件的逻辑
            }

            // 调用基类的 event 函数确保事件继续传递给子部件
            return QDockWidget::event(event);
        }
};

#endif // STACKWINDOW_H
